<!-- 成绩单管理-->
<template>
    <div class="contenBox">
        <div class="leftTree">
            <!-- <Tree :data="treeData" @getLeftTree="getLeftTree"></Tree> -->
            <el-tree :data="treeData" :highlight-current="true" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
        </div>
        <div class="rightContent">
      <div class="rightTop">
        <el-card class="box-card">
           <el-button class="exportBtn" type="info" size="small">
            <span class="icon iconfont icon-daochu" style="font-size:14px;">导出</span>
          </el-button>
        </el-card>
      </div>
      <div class="rightBottom">
        <el-card class="box-card">
            <el-table :data="tableData" border style="width: 100%">
                <el-table-column type="index" label="序号" width="60"> </el-table-column>
                <el-table-column prop="name" label="姓名" width="70" > </el-table-column>
                <el-table-column label="性别" width="60">
                    <template slot-scope="scope">
                        <span>{{scope.row.sex == 0 ? '女' : '男'}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="schoolYear" label="学年学期"> </el-table-column>
                <el-table-column prop="college" label="学院" width="80"> </el-table-column>
                <el-table-column prop="major" label="专业" width="100"> </el-table-column>
                <el-table-column prop="classes" label="班级"> </el-table-column>
                <el-table-column prop="sum" label="总分"  width="60"> </el-table-column>
                <el-table-column
                    label="操作"
                    width="120">
                    <template slot-scope="scope">
                        <el-button @click="seeDetail(scope.row.id)" type="text" size="small">查看详情</el-button>
                        <el-button type="text" size="small" @click="print(scope.row.id)">打印</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="queryParams.pageNum"
                :page-sizes="[5, 10, 15, 20]"
                :page-size="queryParams.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total">
            </el-pagination>
        </el-card>
      </div>
    </div>
    </div>
</template>
<script>
import { colleageTreeDataApi } from "@/api/basics/college.js";
import { getClassifyTreeListApi } from "@/api/basics/classify";
import { getScoreListApi } from "@/api/achievement/studentscore";
export default {
  data() {
    return {
      // 左侧树模拟数据
      treeData: [],
      defaultProps: {
        children: "children",
        label: "label"
      },
      //搜索
      formSearch: {},
      //表格数据
      tableData: [],
      //分页
      queryParams: {
        pageSize: 10,
        pageNum: 1
      },
      total: 0, //总条数,
      sex: []
    };
  },
  mounted() {
    this.upDateTree();
    this.getList()
    getClassifyTreeListApi().then(res => {
      // console.log(res);
      this.sex = res.data[0].children;
    });
  },
  methods: {
    upDateTree() {
      colleageTreeDataApi()
        .then(res => {
          this.treeData = res.data;
        })
        .catch(() => {});
    },
    getList(){
      getScoreListApi(this.queryParams).then(res=>{
        console.log(res,'成绩单管理---');
        this.tableData = res.rows
        this.total = res.total
      })
    },
    //点击左侧树的事件
    handleNodeClick(data) {
      console.log(data);
      getScoreListApi({colleageId:data.id}).then(res=>{
        // console.log(res,'点击左侧树');
        this.tableData = res.rows
      })
    },
    //分页
    handleSizeChange(val) {
      this.queryParams.pageSize = val
      this.getList()
    },
    handleCurrentChange(val) {
      this.queryParams.pageNum = val
      this.getList()
    },
    //跳详情页
    seeDetail(id) {
      console.log(id);
      this.$router.push({
        path: `/Achievement/Achievementdetail/${id}`
      });
    },
    print(id) {
      console.log(id);
      this.$router.push({
        path: `/Achievement/Printdetail/${id}`
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.contenBox {
  // min-width: calc(100vh - 200px);
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  background-color: #f3f2f7;
  padding: 0 20px 20px 15px;
  box-sizing: border-box;

  .leftTree {
    width: 250px;
    // height: 100%;
    // overflow-y: auto;
    // min-height:calc(100vh - 95px);
    background-color: #fff;
    // padding: 15px 15px;
    border-radius: 5px;
    box-sizing: border-box;

    // .tac{
    //   width: 300px;

    //   ::v-deep .el-col-12{
    //     min-height:calc(100vh - 220px);
    //     height: 500px;
    //     overflow-y: auto;
    ::v-deep .el-tree {
      width: 250px;
    }
    ::v-deep .el-tree > .el-tree-node .el-tree-node__content {
      height: 56px;
      position: relative;
      .el-tree-node__expand-icon {
        position: absolute;
        right: 0;
        bottom: 14px;
        transform: rotate(-90deg);
        font-size: 18px;
      }
      .el-tree-node__label {
        font-size: 16px;
        margin-left: 10px;
      }
      .el-tree-node__expand-icon.expanded {
        transform: rotate(0deg);
      }

      .el-icon-caret-right:before {
        content: "\e6df";
      }
    }

    ::v-deep.el-menu {
      border: none;
    }

    // ::v-deep .el-submenu.is-active .el-submenu__title {
    //   color: #409eff;
    // }

    // ::v-deep .el-submenu .el-menu-item {
    //   height: 40px;
    //   line-height: 40px;
    // }

    // ::v-deep .el-menu-item.is-active {
    //   border-right: solid 2px #409eff;
    // }

    // ::v-deep .el-submenu__icon-arrow {
    //   transform: rotateZ(-90deg);
    //   font-size: 16px;
    // }

    // ::v-deep .el-submenu.is-opened > .el-submenu__title .el-submenu__icon-arrow {
    //   transform: rotateZ(0deg);
    //   color: #409eff;
    // }

    // ::v-deep .el-submenu.is-opened .el-submenu__title {
    //   color: #409eff;
    // }
  }

  .rightContent {
    flex: 1;
    min-width: calc(100vh - 250px);
    // width: 100%;
    margin-left: 15px;
    padding-right: 10px;
    // background-color: #fff;
    border-radius: 5px;
    box-sizing: border-box;

    .rightTop {
      width: 100%;
      .el-card {
        height: 100%;
      }
    }

    .rightBottom {
      margin-top: 20px;
      box-sizing: border-box;
      // height: 400px;
      // overflow-y: auto;

      .edit {
        cursor: pointer;
        margin-right: 15px;
      }
      .del {
        cursor: pointer;
      }

      .pagination {
        display: flex;
        align-items: center;
        justify-content: right;
        margin-top: 20px;
        margin-right: 20px;

        .jumper {
          font-size: 14px;
          margin-left: 20px;
          margin-right: 10px;
          display: flex;
          align-items: center;
        }

        ::v-deep .btn-prev,
        ::v-deep .btn-next,
        button {
          height: 28px;
          line-height: 28px;
          border-radius: 5px;
          font-size: 14px;
          padding: 0 8px;
          border: solid 1px #e6e6e6;
        }

        .submit {
          color: #fff;
          background-color: #4895db;
          border: solid 1px #4895db;
        }
      }
    }
  }
}
</style>
